package org.ccams.dao;

import java.util.List;

import org.ccams.domain.TGoodsclass;
import org.ccams.util.PageParameter;
import org.springframework.orm.ibatis.support.SqlMapClientDaoSupport;

public class TGoodsclassDAO extends SqlMapClientDaoSupport {

   
    public TGoodsclassDAO() {
        super();
    }

    
    public int insert(TGoodsclass record) {
        return getSqlMapClientTemplate().update("t_goodsclass.abatorgenerated_insert", record);
    }

   
    public int updateByPrimaryKey(TGoodsclass record) {
        int rows = getSqlMapClientTemplate().update("t_goodsclass.abatorgenerated_updateByPrimaryKey", record);
        return rows;
    }

    public int updateByPrimaryKeySelective(TGoodsclass record) {
        int rows = getSqlMapClientTemplate().update("t_goodsclass.abatorgenerated_updateByPrimaryKeySelective", record);
        return rows;
    }

    public TGoodsclass selectByPrimaryKey(Integer idtGoodsclass) {
        TGoodsclass key = new TGoodsclass();
        key.setIdtGoodsclass(idtGoodsclass);
        TGoodsclass record = (TGoodsclass) getSqlMapClientTemplate().queryForObject("t_goodsclass.abatorgenerated_selectByPrimaryKey", key);
        return record;
    }

    
    public int deleteByPrimaryKey(Integer idtGoodsclass) {
        TGoodsclass key = new TGoodsclass();
        key.setIdtGoodsclass(idtGoodsclass);
        int rows = getSqlMapClientTemplate().delete("t_goodsclass.abatorgenerated_deleteByPrimaryKey", key);
        return rows;
    }
    
    /**
	 * 返回指定页码数据
	 * @return
	 */
	@SuppressWarnings({ "unchecked", "deprecation" })
	public  List<TGoodsclass> getTGoodsclass(PageParameter pageParmeter){		
		return getSqlMapClientTemplate().queryForList("t_goodsclass.getByPage", pageParmeter);
	}
	
	/**
	 * 返回记录总数
	 * @return
	 */
	public int getCount(){
		return (Integer)getSqlMapClientTemplate().queryForObject("t_goodsclass.getCount");
	}
	/**
	 * 返回所有
	 * @return
	 */
	@SuppressWarnings("unchecked")
	public  List<TGoodsclass> getAll(){		
		return getSqlMapClientTemplate().queryForList("t_goodsclass.getAll");
	}
}